Optimal. Leaf size=107 \[ \frac {5 \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)}}\right )}{4 \sqrt {2} \sqrt {a} f}-\frac {\sec (e+f x)}{2 f \sqrt {a+a \sin (e+f x)}}+\frac {3 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{4 a f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 107, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {2791, 2934,
2728, 212} \begin {gather*} \frac {3 \sec (e+f x) \sqrt {a \sin (e+f x)+a}}{4 a f}-\frac {\sec (e+f x)}{2 f \sqrt {a \sin (e+f x)+a}}+\frac {5 \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a \sin (e+f x)+a}}\right )}{4 \sqrt {2} \sqrt {a} f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 2728
Rule 2791
Rule 2934
Rubi steps
\begin {align*} \int \frac {\tan ^2(e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx &=-\frac {\sec (e+f x)}{2 f \sqrt {a+a \sin (e+f x)}}+\frac {\int \sec ^2(e+f x) \sqrt {a+a \sin (e+f x)} \left (-\frac {a}{2}+2 a \sin (e+f x)\right ) \, dx}{2 a^2}\\ &=-\frac {\sec (e+f x)}{2 f \sqrt {a+a \sin (e+f x)}}+\frac {3 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{4 a f}-\frac {5}{8} \int \frac {1}{\sqrt {a+a \sin (e+f x)}} \, dx\\ &=-\frac {\sec (e+f x)}{2 f \sqrt {a+a \sin (e+f x)}}+\frac {3 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{4 a f}+\frac {5 \text {Subst}\left (\int \frac {1}{2 a-x^2} \, dx,x,\frac {a \cos (e+f x)}{\sqrt {a+a \sin (e+f x)}}\right )}{4 f}\\ &=\frac {5 \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)}}\right )}{4 \sqrt {2} \sqrt {a} f}-\frac {\sec (e+f x)}{2 f \sqrt {a+a \sin (e+f x)}}+\frac {3 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{4 a f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.18, size = 118, normalized size = 1.10 \begin {gather*} -\frac {\sec (e+f x) \left (-1+(5+5 i) (-1)^{3/4} \tanh ^{-1}\left (\left (\frac {1}{2}+\frac {i}{2}\right ) (-1)^{3/4} \left (-1+\tan \left (\frac {1}{4} (e+f x)\right )\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^2-3 \sin (e+f x)\right )}{4 f \sqrt {a (1+\sin (e+f x))}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 1.70, size = 130, normalized size = 1.21
method | result | size |
default | \(\frac {\sin \left (f x +e \right ) \left (5 \sqrt {2}\, \arctanh \left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) \sqrt {a -a \sin \left (f x +e \right )}\, a +6 a^{\frac {3}{2}}\right )+5 \sqrt {2}\, \arctanh \left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) \sqrt {a -a \sin \left (f x +e \right )}\, a +2 a^{\frac {3}{2}}}{8 a^{\frac {3}{2}} \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}\) | \(130\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 219 vs.
\(2 (94) = 188\).
time = 0.36, size = 219, normalized size = 2.05 \begin {gather*} \frac {5 \, \sqrt {2} {\left (\cos \left (f x + e\right ) \sin \left (f x + e\right ) + \cos \left (f x + e\right )\right )} \sqrt {a} \log \left (-\frac {a \cos \left (f x + e\right )^{2} + 2 \, \sqrt {2} \sqrt {a \sin \left (f x + e\right ) + a} \sqrt {a} {\left (\cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right )} + 3 \, a \cos \left (f x + e\right ) - {\left (a \cos \left (f x + e\right ) - 2 \, a\right )} \sin \left (f x + e\right ) + 2 \, a}{\cos \left (f x + e\right )^{2} - {\left (\cos \left (f x + e\right ) + 2\right )} \sin \left (f x + e\right ) - \cos \left (f x + e\right ) - 2}\right ) + 4 \, \sqrt {a \sin \left (f x + e\right ) + a} {\left (3 \, \sin \left (f x + e\right ) + 1\right )}}{16 \, {\left (a f \cos \left (f x + e\right ) \sin \left (f x + e\right ) + a f \cos \left (f x + e\right )\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\tan ^{2}{\left (e + f x \right )}}{\sqrt {a \left (\sin {\left (e + f x \right )} + 1\right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 20.31, size = 164, normalized size = 1.53 \begin {gather*} \frac {\frac {5 \, \sqrt {2} \log \left (\sin \left (\frac {3}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{\sqrt {a} \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )} - \frac {5 \, \sqrt {2} \log \left (-\sin \left (\frac {3}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{\sqrt {a} \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )} + \frac {2 \, \sqrt {2} {\left (3 \, \sin \left (\frac {3}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2\right )}}{{\left (\sin \left (\frac {3}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - \sin \left (\frac {3}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )} \sqrt {a} \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{16 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\mathrm {tan}\left (e+f\,x\right )}^2}{\sqrt {a+a\,\sin \left (e+f\,x\right )}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________